//
//  ConfigHeader.h
//  SCOffers
//
//  Created by kevin on 14-5-13.
//  Copyright (c) 2014年 kevin. All rights reserved.
//

#import <Foundation/Foundation.h>


@protocol ConfigHeader <NSObject>

#pragma mark 命名规范取图
#define ADAPT_IMAGE_NAME(ImageName)  [NSString stringWithFormat:@"%@%@",ImageName,ISIphone_4?@"":ISIphone_5?@"-568":ISIphone_6?@"-667":@"-736"]

#pragma mark 初始化页面window
#define YBKINITWINDOW  self.window= [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];\
                       [self.window makeKeyAndVisible];\
                        if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {\
                        self.navigationController.interactivePopGestureRecognizer.delegate = nil;\
                        }//下面这段代码是为了实现ios7自带的返回手势

#pragma mark 创建一个单例的宏定义
#define YBKDEFINE_SINGLETON_FOR_HEADER(className) \
\
+ (className *)shared##className;

#define YBKDEFINE_SINGLETON_FOR_CLASS(className) \
\
+ (className *)shared##className { \
static className *shared##className = nil; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
shared##className = [[self alloc] init]; \
}); \
return shared##className; \
}

#pragma mark  项目名 Project
#define YBKProjectName @"weixiaowangBase"

#pragma mark 取消网络
#define YBKCancelNetWork(object) if(object) [object cancelDownload];object = nil;

#pragma mark 是否打印
#define isLog  0
#ifdef isLog
    #define YHNSLOG(object) NSLog(@"object === %@",object)
#endif




#pragma mark 字体颜色RGB函数
#define YBKRGBCOLOR(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define YBKHEXCOLOR(colorV)        [UIColor colorWithHexColorString:colorV]
#define YBKHEXCOLORAlpha(colorV,a) [UIColor colorWithHexColorString:colorV alpha:a]
#define YBKRAMDOMCOLOR [UIColor colorWithRed:arc4random_uniform(255)/255.0f green:arc4random_uniform(255)/255.0f blue:arc4random_uniform(255)/255.0f alpha:1.0f]

#pragma mark 系统字体
#define YBKSystemFont(size) [UIFont systemFontOfSize:size]


#define YBKSystemAdFont(size) [UIFont boldSystemFontOfSize:size]




#pragma mark 系统加粗字体
#define YBKSystemBoldFont(size) [UIFont boldSystemFontOfSize:size]
#pragma mark 字体大小s
#define YHKFONTSIZE_1 10.0f
#define YHKFONTSIZE_2 12.0f
#define YHKFONTSIZE_3 14.0f
#define YHKFONTSIZE_4 16.0f
#define YHKFONTSIZE_5 18.0f
#define YHKFONTSIZE_6 18.0f
#define YHKFONTSIZE_7 20.0f
#define YHKFONTSIZE_8 222.0f
#pragma mark 屏幕大小
#define YBKWinFrame [[UIScreen mainScreen] bounds]
#define YBKAppFrame [[UIScreen mainScreen] applicationFrame]
#pragma mark 判断是否是IPhone5
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#pragma mark 获取APP 版本
#define YBKAppCurrentVersion  [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]

#pragma mark 获取系统信息
#define YHUIDevice [UIDevice currentDevice]
#pragma mark  系统版本
#define YHSysVersion [YHUIDevice systemVersion]
#pragma mark 系统的名字
#define YHSysName [YHUIDevice systemName]
#pragma mark 系统model
#define YHSysModel [YHUIDevice model]
#pragma mark 系统localizedModel
#define YHSysLocalizedModel [YHUIDevice localizedModel]


/**
 *  整个屏幕宽度
 */
#define MDK_SCREEN_WIDTH  [[UIScreen mainScreen] bounds].size.width

/**
 *  整个屏幕高度
 */
#define MDK_SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height

/**
 *  16进制颜色转换
 */
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#pragma mark 设置NULL
#define YHSetObjectNULL(object) object = nil
#pragma mark 给NSObject设置值
#define YHSetObjectValue(object,value) object = value

#pragma mark   主要单例
#define YBKUserDefaults         [NSUserDefaults standardUserDefaults]
#define YBKNotificationCenter   [NSNotificationCenter defaultCenter]
#define YBKShareApplication    [UIApplication sharedApplication]

#pragma mark UIWindow
#define YBKKeyWindow  [YBKShareApplication keyWindow]

#pragma mark Application delegate
#define YBKShareAppDelegate ((AppDelegate *)YBKShareApplication.delegate)

#pragma mark 键盘显示状态
#define YBKKeyBoardState(bool) [YBKKeyWindow endEditing:bool]

#pragma mark 定义属性
#define YBKProperty(type,class,value) @property (nonatomic,type) class value;


#define ImageWithName(name) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForAuxiliaryExecutable:name]]

//大小 坐标相关

#pragma mark 获取屏幕的宽度
#define YHGetScreenWidth  YBKWinFrame.size.width

#pragma mark 获取屏幕的高度
#define YHGetScreenHeight YBKWinFrame.size.height

#pragma mark 获取对象的CGRect
#define YHGetRect(obj) obj.frame

#pragma mark 获取X坐标
#define YHGetOriginX(obj) YHGetRect(obj).origin.x

#pragma mark 获取Y坐标
#define YHGetOriginY(obj) YHGetRect(obj).origin.y

#pragma mark 获取对象的Width
#define YHGetSizeWidth(obj) YHGetRect(obj).size.width

#pragma mark 获取对象的Height
#define YHGetSizeHeight(obj) YHGetRect(obj).size.height

#pragma mark 获取X＋ Width x偏移量
#define YHGetAddWidthToX(obj,x) YHGetOriginX(obj)+YHGetSizeWidth(obj)+x

#pragma mark 获取Y+Height y偏移量
#define YHGetAddHeightToY(obj,y) YHGetOriginY(obj)+YHGetSizeHeight(obj)+y

#pragma mark 是否是7.0以上系统
#define IOS7 (([[YHUIDevice systemVersion] floatValue]>=7)?1:0)

#pragma mark 是否是8.0以上系统
#define IOS8 (([[YHUIDevice systemVersion] floatValue]>=8)?1:0)

#pragma mark 是否是10.0以上系统
#define IOS10 (([[YHUIDevice systemVersion] floatValue]>=10)?1:0)


#define YBKPlaceHolderImage   [UIImage imageNamed:@""]



//iphone手机型号
#define ISIphone_4 ([UIScreen mainScreen].bounds.size.height==480.0f)
#define ISIphone_5 ([UIScreen mainScreen].bounds.size.height==568.0f)
#define ISIphone_6 ([UIScreen mainScreen].bounds.size.height==667.0f)
#define ISIphone_6P ([UIScreen mainScreen].bounds.size.height==736.0f || [UIScreen mainScreen].bounds.size.height==414.0f)

#pragma mark 解决字号适配
#define YBKAdaptiveFont(x)  ISIphone_4 ? x : ISIphone_5? x:ISIphone_6? x+2 : x+3

#pragma mark 适配320，375，414 宽度的按照比列放大
#define YBKAdaptiveW(x) [UIScreen mainScreen].bounds.size.width*x/375

#define YBKAdaptiveH(x) [UIScreen mainScreen].bounds.size.height*x/667


#pragma mark 快速获取不为空的字符串
#define S(s) [PublicFunction getValue:s]

#pragma mark 顶一个一个宏只用来定义字符串参数
#define Str(s) @property(nonatomic,copy) NSString * s

#pragma mark  解决performSelector 警告(这个是执行一个方法)
#define SuppressPerformSelectorLeakWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)

@end
#import "AppDelegate.h"
#import "HCUserTools.h"
#import "YBKFileManager.h"
#import "ConfigHeaderProjectExtern.h"
#import <SDWebImageDownloader.h>
#import "YBKViewcontrollerAnimation.h"
#import "UIColor+Extend.h"
#import "WZNetWorkStatusManager.h"
#import <JSONModel/JSONModel.h>
#import <UIImageView+WebCache.h>
#import "CALayer+Extend.h"
#import "PublicErrorAlterView.h"
#import "PublicFunction.h"

#import <MBProgressHUD.h>
#import "ZXPAutoLayout.h"
#import "HCPopLoadingView.h"
#import <MJRefresh.h>
